package com.kx.kxblog.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.kx.kxblog.enums.UserStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Accessors(chain = true)
@Table(indexes = @Index(columnList = "user"))
@ApiModel(value = "User", description = "用户")
public class User extends AbstractEntity{
    @Column(length = 32, nullable = false, unique = true)
    @ApiModelProperty(value = "用户名", required = true)
    private String user;

    @Column(length = 32, nullable = false)
    @ApiModelProperty(value = "昵称", required = true)
    private String nickName;

    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @Column(length = 32, nullable = false)
    @ApiModelProperty(value = "密码")
    private String password;

    @Column(length = 32)
    @ApiModelProperty(value = "邮箱")
    private String email;

    @Column(nullable = false)
    @ApiModelProperty(value = "状态")
    private Character status = UserStatus.ACTIVITY.getStatus();

//    @Column(length = 64, unique = true)
//    @ApiModelProperty(value = "Token")
//    private String token;
}
